# -*- coding=utf-8 -*-

#题目：输入某年某月某日，判断这一天是这一年的第几天？

year = raw_input("年:")
month = raw_input("月:")
day = raw_input("日:")

Months = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

if ( int(year) < 0 ):
    exit(1)

if (int(month) <1 or int(month)>12):
    exit(2)

#判断是否闰年， 判断是否
if (int(year)%400 == 0) or ((int(year) %4 == 0) and (int(year)%100 !=0)):
    Months[2] = Months[2]+1
print("二月：%d") %(Months[2])

if (int(day) < 1 or int(day) > Months[int(month)]):
    exit(3)

days = int(day)
for i in range(0, int(month)):
    days += Months[i]

print ("一年中的第%d天") %(days)